#!/bin/bash

source /etc/profile

basepath=$(cd `dirname $0`; pwd)

cd $basepath

tpath=`find . -name '*.jar'`
echo -e " # finded jar: ${tpath} "

jar=`basename $tpath`
jar=${jar%admin*}admin

#kill progress
 pid=`jps -l |grep $jar|awk '{print $1}'`
 if [ -n "$pid" ];then
   echo -e " # Kill Server PID: $pid . "
   output=`kill -15 $pid`
   output=`kill -9 $pid`
 fi

echo -e "\n # Startup $jar ... "
java -jar -Dspring.profiles.active=pro $tpath > console.log &
